package com.leshua.channel.mpos.common.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 日志工具
 */
public class LoggerUtil {

    private static final Logger monitorLogger = LoggerFactory.getLogger("MONITOR");
    private static final Logger summaryLogger = LoggerFactory.getLogger("SUMMARY");
    /**模块名*/
    private static final String MODULE_NAME = "ordering-platform";

    public static void summary(String uri,Long costTime){
        summaryLogger.info( MODULE_NAME + "{uri=\"{}\"} {}" ,new Object[]{uri,costTime} );
    }

    /**
     * 	业务状态日志
     * 	格式: channel_shuabao{uri="xxx",result="200" } 1  ,  uri,result都可以自定义，根据业务需要扩展
     */
    public static void writeBusinessLog(String uri, String result) {
        writeMonitorLog(MODULE_NAME + "{uri=\"{}\",result=\"{}\"} 1", uri,result);
    }

    /************************************************** Private Methods **************************************************/

    /**
     * 写入监控日志
     *
     * @param content
     * @param args
     */
    private static void writeMonitorLog(String content, Object... args) {
        monitorLogger.info(content, args);
    }
}